<?php
namespace App\Service\OrderService\OrderInterfaceService;
use App\Service\BaseService;
use App\Service\AppService\SystemCacheConfigService;
use App\Service\VendorClient\ShopBdCRM\ShopBdCRMApiClient;

/**
 * 百大CRM交易中心
 * @author chenshubo
 */
class OrderTradeBdCrmCenter extends BaseService
{
    /**
     * 会员注册
     * @param array $param
     */
    public function vipUserRegister(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->vipUserRegister($param);
    }
    
    /**
     * 会员信息查询
     * @param array $param
     */
    public function vipUserQuery(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->vipUserQuery($param);
    }
    
    /**
     * 会员信息更新
     * @param array $param
     */
    public function vipUserUpdate(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->vipUserUpdate($param);
    }
    
    /**
     * 会员积分增加
     * @param array $param
     */
    public function vipUserPointsUpdate(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->vipUserPointsUpdate($param);
    }
    
    /**
     * 会员积分变动查询
     * @param array $param
     */
    public function vipUserPointsLogQuery(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->vipUserPointsLogQuery($param);
    }
    
    /**
     * 会员门店编码优惠券发放
     * @param array $param
     */
    public function vipUserStoreCouponSend(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->vipUserStoreCouponSend($param);
    }
    
    /**
     * 会员门店优惠券状态
     * @param array $param
     */
    public function vipUserStoreCouponInfo(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->vipUserStoreCouponInfo($param);
    }
    
    /**
     * 会员预付卡信息查询
     * @param array $param
     */
    public function vipUserCashCardInfo(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->vipUserCashCardInfo($param);
    }
    
    /**
     * 会员预付卡使用冻结
     * @param array $param
     */
    public function vipUserCashCardFrost(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->vipUserCashCardFrost($param);
    }
    
    /**
     * 会员预付卡使用确认
     * @param array $param
     */
    public function vipUserCashCardPayConfirm(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->vipUserCashCardPayConfirm($param);
    }

    /**
     * 会员预付卡使用取消
     * @param array $param
     */
    public function vipUserCashCardPayCancel(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->vipUserCashCardPayCancel($param);
    }

    /**
     * 会员交易上传商品
     * @param array $param
     */
    public function vipUserOrderTradeCreate(array $param,array $config = [])
    {
        return (new ShopBdCRMApiClient( $config ? $config : self::getBdCrmConfig()))->vipUserOrderTradeCreate($param);
    }
    
    /**
     * 会员交易准备结账
     * @param array $param
     */
    public function vipUserOrderTradePreparePay(array $param,array $config = [])
    {
        return (new ShopBdCRMApiClient( $config ? $config : self::getBdCrmConfig()))->vipUserOrderTradePreparePay($param);
    }
    
    /**
     * 会员交易结账
     * @param array $param
     */
    public function vipUserOrderTradePay(array $param,array $config = [])
    {
        return (new ShopBdCRMApiClient( $config ? $config : self::getBdCrmConfig()))->vipUserOrderTradePay($param);
    }
    
    /**
     * 钱买分接口
     * @param array $param
     */
    public function tradeBuyPoints(array $param)
    {
        return (new ShopBdCRMApiClient(self::getBdCrmConfig()))->tradeBuyPoints($param);
    }
    
    /**
     * 获取百搭接口配置
     * @param array $param
     */
    public function getBdCrmConfig() 
    {
        return SystemCacheConfigService::instance()->getCacheInfoBySystemCode('bd_crm_center');
    }
}